<?php  include VIEWPATH.'common/head.php';  ?>
<script type="text/javascript">
</script>
    <body class="gray-bg">
    <div class="wrapper wrapper-content">

        <div class="modal fade" id="add_rules" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
            <div class="modal-dialog" style="width: 50%;">
                <div class="modal-content"></div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><?php echo $_REQUEST['channel_name'];?></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
                            <div class="post-list" style="margin-top:0px;">
                                <ul id="myTab" class="nav nav-tabs">
                                    <li class="<?php if($_GET['m']=="result_list"){ echo "active";} ?>">
                                        <a href="index.php?c=topic&m=result_list&id=<?php echo $_REQUEST['id'];?>">结果预览</a>
                                    </li>
                                    <li class="<?php if($_GET['m']=="recommend"){ echo "active";} ?>">
                                        <a href="index.php?c=topic&m=recommend&id=<?php echo $_REQUEST['id'];?>">默认规则的帖子</a>
                                    </li>
                                    <li class="<?php if($_GET['m']=="custom_list"){ echo "active";} ?>">
                                        <a href="index.php?c=topic&m=custom_list&id=<?php echo $_REQUEST['id'];?>">定制运营的帖子</a>
                                    </li>
                                    <li class="<?php if($_GET['m']=="del_list"){ echo "active";} ?>">
                                        <a href="index.php?c=topic&m=del_list&id=<?php echo $_REQUEST['id'];?>">被移除的帖子</a>
                                    </li>

                                    <div class="clearfix"></div>
                                </ul>
                                <div id="myTabContent" class="tab-content">
                                    <div class="pub_tag_talent">
                                        <div class="add-btn" style="float:right;margin-bottom:5px;">
                                            <a href="index.php?c=topic&m=edit_rule&id=<?php echo $_REQUEST['id'];?>" class="btn btn-danger" data-toggle="modal" data-target="#add_rules">编辑规则</a>
                                        </div>
                                        <div class="clearfix"></div>

                                        <form class="form-horizontal" name="form" id="rule_list_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" method="post">
                                            <table class="table table-bordered table-hover">
                                                <thead>
                                                <tr class="active">
                                                    <th>排序</th>
                                                    <th>标题</th>
                                                    <th>统计</th>
                                                    <th>发布时间</th>
                                                    <th>帖子类型</th>
                                                    <th>移除</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php
                                                $index = $page - 1 < 0 ? 0 : ($page - 1) * $pagesize;
                                                if($list){
                                                foreach($list as $k => $v){
                                                    $article = $article["_source"];?>
                                                    <tr>
                                                        <td><?php echo $index+ $k +1;?></td>
                                                        <td>

                                                            <a class="J_menuItem" data-names="帖子列表"  href="index.php?c=post&m=post_list&&s_type_id=1&s_content=<?php echo $v['id']?>">
                                                                <?php echo $v['title'];?>
                                                            </a>
                                                        </td>
                                                        <td>评论数：<?php echo $v['comment_num'];?> 查看数：<?php echo $v['show_num'];?> 点赞数：<?php echo $v['like_num'];?> </td>
                                                        <td><?php echo date('Y-m-d H:i:s',$v['add_time']);?></td>
                                                        <td><?php
                                                            if($v['type']==0){echo "用户发布";}
                                                            if($v['type']==1){echo "机器人发布";}
                                                            if($v['type']==2){echo $v['source']?$v['source'].'导入':"未知导入";}
                                                            ?>
                                                        </td>
                                                        <td><a href="javascript:void(0)" onclick="del_post(<?php echo $v['id'];?>)">移除</a></td>
                                                    </tr>
                                                <?php } }?>
                                                </tbody>
                                            </table>
                                            <div class="set_page">
                                                <?php echo $multipage;?>
                                                <div class="set_del">
                                                </div>
                                                <div class="clearfix"></div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
<script>
    function del_post(id){
        if(confirm("是否确认从推荐聚合页面移除此帖子？")){
            var url = 'index.php?c=topic&m=del_post&post_id='+id+'&id=<?php echo $id;?>';
            var param = {};
            common_ajax(url, param, function(data){
                if(data.errorCode == 0) {
                    //表单提交
                    window.location.href = window.location.href;
                    return;
                }else{
                    console.log(data.errorMsg);
                    alert(data.errorMsg);
                }
            });
        }
    }
</script>
<?php  include VIEWPATH.'common/footer.php';  ?>